<?php foreach($table_data As $control=>$table): ?>
    <?php 
        $rowCol = $table['0header0'];
        unset($table['0header0']);
    ?>
    <table class="permission-table noticebox">
        <tr>
            <th><?php print $control; ?></th>
            <?php foreach($rowCol As $col):?>
                <th class="text-center"><?php print $col; ?></th>
            <?php endforeach; ?>
        </tr>
    
        <?php foreach($table As $key=>$row): ?>
        <tr>
            <th><?php print $key; ?></th>
            <?php foreach($rowCol As $col): ?>
                <?php if( isset($row[$col]) ):?>
                    <?php if($row[$col]['checked'] == true): ?>
                        <td class="text-center"><input class="change-premission" type="checkbox" checked="checked" value="<?php print $row[$col]['permission_id']; ?>" role="<?php print $roleId; ?>" rel="<?php print site_url('roles/setPermission/'.$roleId.'/'.$row[$col]['permission_id'].'/unset'); ?>"></td>
                    <?php else :?>
                        <td class="text-center"><input class="change-premission" type="checkbox" value="<?php print $row[$col]['permission_id']; ?>" role="<?php print $roleId; ?>" rel="<?php print site_url('roles/setPermission/'.$roleId.'/'.$row[$col]['permission_id'].'/set'); ?>"></td>
                    <?php endif;?>
                <?php else: ?>
                    <td></td>
                <?php endif; ?>
            <?php endforeach; ?>
        </tr>
        <?php endforeach; ?>
    </table>
    
<?php endforeach; ?>